<template>
  <el-dialog
    title="存证数据"
    :visible.sync="dialogVisible"
    width="700px"
    append-to-body
  >
    <el-collapse accordion>
      <el-collapse-item v-for="item in tableData" :key="item.id">
        <template slot="title">
          <div style="display: block;line-height: 20px;">
            <!-- 存正内容，1快递出库，2用户身份证，3补充协议，4用户人脸，5线下付款，6其他存证，7企业信息 -->
            <div v-if="item.option == 1">快递出库</div>
            <div v-if="item.option == 2">用户身份证</div>
            <div v-if="item.option == 3">补充协议</div>
            <div v-if="item.option == 4">用户人脸</div>
            <div v-if="item.option == 5">线下付款</div>
            <div v-if="item.option == 6">其他存证</div>
            <div v-if="item.option == 7">企业信息</div>
            <div>{{ item.create_time }}</div>
          </div>
        </template>
        <!-- 类型，1图片，2文件，3音频，4视频 -->
        <div v-if="item.type == 1">
          <img width="500px" :src="$globalObj.imgBaseUrl+item.file">
        </div>
        <div v-else>
          <a
            :href="$globalObj.imgBaseUrl+item.file"
            class="blue-font"
            target="_blank"
            download
          >下载文件</a>
        </div>
      </el-collapse-item>
    </el-collapse>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="primary"
        @click="dialogVisible=false"
      >关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getTWCFile } from '@/api/order'
// import customPage from '@/components/customPage'
export default {
  // components: { customPage },
  props: ['orderId'],
  data() {
    return {
      activeName: 'deduct',
      dialogVisible: false,
      tableData: []
      // total: 0
    }
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        this.$nextTick(() => {
          this.getDeduct()
        })
      }
    }
  },
  methods: {
    getDeduct() {
      // const { page, pageSize } = this.$refs.customPage
      getTWCFile({
        order_id: this.orderId
      }).then(res => {
        this.tableData = res || []
        debugger
        // this.total = res.total || 0
      })
    }
  }
}
</script>

<style>
</style>
